home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Select (Limited Edition)
/
Computer Select.iso
/
pcmag
/
v11n10
/
binary.bas
next >
Wrap
BASIC Source File
|
1991-03-29
|
1KB
|
44 lines
'BINARY.BAS - benchmark to compare Binary and Sequential access
Start! = TIMER
OPEN "STANDARD.DAT" FOR OUTPUT AS #1
FOR X% = 1 TO 5000
PRINT #1, X%
NEXT
CLOSE #1
Done! = TIMER
PRINT USING "##.### seconds to write a sequential file"; Done! - Start!
Start! = TIMER
OPEN "BINARY.DAT" FOR BINARY AS #1
FOR X% = 1 TO 5000
PUT #1, , X%
NEXT
CLOSE #1
Done! = TIMER
PRINT USING "##.### seconds to write a binary file"; Done! - Start!
Start! = TIMER
OPEN "STANDARD.DAT" FOR INPUT AS #1
FOR X% = 1 TO 5000
INPUT #1, X%
NEXT
StandardLen& = LOF(1)
CLOSE #1
Done! = TIMER
PRINT USING "##.### seconds to read a sequential file"; Done! - Start!
Start! = TIMER
OPEN "BINARY.DAT" FOR BINARY AS #1
FOR X% = 1 TO 5000
GET #1, , X%
NEXT
BinaryLen& = LOF(1)
CLOSE #1
Done! = TIMER
PRINT USING "##.### seconds to read a binary file"; Done! - Start!
PRINT "The standard sequential file is"; StandardLen&; "bytes long."
PRINT " The binary file is"; BinaryLen&; "bytes long."